#!/bin/bash
# web 初始化用户密码
# admin
# password
# root
# root用户，初始密码
#  yutech
# 管理员密码 user root passwood
# 更换软件源
# /etc/apt/sources.list
yutech

#官方
deb http://mirrors.163.com/debian/ stretch main
deb http://shanghai.unasmirror.com/debian/ callisto main non-free contrib

# 默认注释了源码镜像以提高 apt update 速度，如有需要可自行取消注释
deb http://mirrors4.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
# deb-src http://mirrors4.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free

deb http://mirrors4.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
# deb-src http://mirrors4.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free

deb http://mirrors4.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
# deb-src http://mirrors4.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free

deb http://mirrors4.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
# deb-src http://mirrors4.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free

# 更新数据
apt update

# 安装 autofs
 apt-get install -y autofs
 # 打开配置文件 /etc/auto.master
#行尾：
sed -i '$a \/mnt/usb    /etc/mount-usb.txt --timeout 30' /etc/auto.master

cat > /etc/mount-usb.txt << EOF
32      -fstype=btrfs,rw         :UUID=a38f54c5-76cc-49bc-b8a3-408e27b9fc9a
EOF


systemctl start  autofs
systemctl status autofs
systemctl enable autofs

systemctl restart  autofs

#   qm importdisk 102 /var/lib/vz/template/iso/DS918_7.X.img local-lvm

#   直通硬盘
#   进入PVE的SSH,或者直接进入PVE管理网页Shell
#   查看你现在的存储设备的序列号:

#   ls -l /dev/disk/by-id/
#   然后就能看到所有存储设备的序列号

#     32t usb 硬盘
#     usb-Flash_USB_Disk_3727024C3EB8061121827-0:0
#     4t 机械硬盘
#     ata-ST4000NM0053_Z1Z4AV26
#     120g 固态硬盘
#     ata-KINGSTON_SV300S37A120G_50026B77028WM019

#     qm set 101 -sata3 /dev/disk/by-id/ata-ST4000NM0053_Z1Z4AV26
#     qm set 101 -sata4 /dev/disk/by-id/ata-KINGSTON_SV300S37A120G_50026B77028WM019
#     qm set 101 -sata5 /dev/disk/by-id/usb-Flash_USB_Disk_3727024C3EB8061121827-0:0


#   我的西数硬盘序列号是ata-WDC_WDXXXX_XXXX_XXXX,记住这个序列号
#   然后输入以下代码(请把硬盘序列号换成你硬盘的,102换成你虚拟机ID)
#   sata1是102里面的硬盘0 1 2 3 的有1就要改成2了。

#   qm set 102 -sata1 /dev/disk/by-id/ata-WDC_WDXXXX_XXXX_XXXX

#   如果返回以下信息,说明已成功挂载
#   update VM 102: -sata1 /dev/disk/by-id/ata-WDC_WDXXXX_XXXX_XXXX

qm importdisk 104 /var/lib/vz/template/iso/install-docker.img local-lvm





ssh-keygen -t rsa -b 4096 -C "ubunt"